<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link href="/zero/resources/dijit/themes/tundra/tundra.css" type="text/css" rel="stylesheet" />
<link href="/zero/resources/styles/standard.css" media="screen" type="text/css" rel="stylesheet" />
<link href="/zero/resources/images/favicon.ico" rel="SHORTCUT ICON" />
<script type="text/javascript">
	var djConfig = {
		parseOnLoad : false,
		isDebug : false,
		locale : 'zh'
	};
</script>
<script type="text/javascript" src="/zero/resources/dojo/dojo.js"></script>
<script type="text/javascript" src="/zero/resources/spring/Spring.js"></script>
<script type="text/javascript" src="/zero/resources/spring/Spring-Dojo.js"></script>
<script type="text/javascript" language="JavaScript">
	dojo.require("dojo.parser");
</script>

</head>
<body>

	<script type="text/javascript">
		dojo.require('dijit.TitlePane');
	</script>
    
	<spring:message code="process.menu.my.instances" htmlEscape="false" javaScriptEscape="true" var="panel_title"/>
	
	<div id="_title_fc_com_ibm_zero_domain_task_id">
		<script type="text/javascript">
			Spring.addDecoration(new Spring.ElementDecoration({
				elementId : '_title_fc_com_ibm_zero_domain_task_id',
				widgetType : 'dijit.TitlePane',
				widgetAttrs : {
					title : '${panel_title}',
					open : true
				}
			}));
		</script>
		

	<br>
	<label><spring:message code="process_id" htmlEscape="false" /></label>
	<div>
		<c:out value="${instance.id }" />
	</div>
	<br>

	<label><spring:message code="process_name" htmlEscape="false" /></label>
	<div>
		<c:out value="${definition.name }" />
	</div>
	<br>

	<label><spring:message code="process_started" htmlEscape="false" /></label>
	<div>
		<c:out value="${instance.startTime }" />
	</div>
	<br>

	<h3><spring:message code="process.header.diagram" htmlEscape="false" /></h3>
	<br>
	<div>
		<spring:url value="/myProcess/${instance.id }" var="image_url">
			<spring:param name="instanceImage" />
		</spring:url>
		<img alt="Process instance image" src="${image_url }">
	</div>
	<br>

	<h3><spring:message code="process.instance.header.tasks" htmlEscape="false" /></h3>
	<br>

	<table>
		<tr>
			<th><spring:message code="task.name" htmlEscape="false" /></th>
			<th><spring:message code="task.priority" htmlEscape="false" /></th>
			<th><spring:message code="task.assignee" htmlEscape="false" /></th>
			<th><spring:message code="task.duedate" htmlEscape="false" /></th>
			<th><spring:message code="task.create.time" htmlEscape="false" /></th>
			<th><spring:message code="task_complete_date" htmlEscape="false" /></th>
			<th></th>
		</tr>
		<c:forEach items="${tasks }" var="task">
			<tr><!-- if (task.getEndTime() != null) -->
				<td><c:out value="${task.name }" /></td>
				<td><c:out value="${task.priority }" /></td>
				<td><c:out value="${task.assignee }" /></td>
				<td><c:out value="${task.dueDate }" /></td>
				<!-- yyyy/MM/dd:HH:mm:ss -->
				<td><fmt:formatDate value="${task.startTime }" type="both" dateStyle="short" timeStyle="short" /> </td>
				<td><fmt:formatDate value="${task.endTime }" type="both" dateStyle="short" timeStyle="short" /> </td>
				<td>
					
					<c:url value="/tasks/${task.id }" var="show_form_url">
						<c:param name="historical"></c:param>
					</c:url> 
					<spring:url value="/resources/images/show.png" var="show_image_url" /> 
					<spring:message arguments="${task.name }" code="entity_show" var="show_label" htmlEscape="false" />
					<a href="${show_form_url}" title="${fn:escapeXml(show_label)}"> 
						<img alt="show" class="image" src="${show_image_url}" title="${fn:escapeXml(show_label)}" />
					</a>
				</td>
				<!-- 
<c:forEach items="${taskCandidates[task.id] }" var="user">
[<c:out value="${user.firstName }"></c:out>]
</c:forEach> -->

			</tr>
		</c:forEach>
	</table>
	<br>

	<h3><spring:message code="process.instance.header.variables" htmlEscape="false" /></h3>
	<br>

	<table>
		<tr>
			<th><spring:message code="process.instance.variable.name" htmlEscape="false" /></th>
			<th><spring:message code="process.instance.variable.value" htmlEscape="false" /></th>
		</tr>
		<c:forEach items="${variables }" var="variable">
			<tr>
				<td><c:out value="${variable.key }" /></td>
				<td><c:out value="${variable.value }" /></td>
			</tr>
		</c:forEach>
	</table>
	<br>
	
	<div>
		<c:url value="/myProcess/${instance.id }" var="action_url" />
		<spring:message arguments="${instance.id }" code="entity_delete" var="delete_label" htmlEscape="false" />
		<c:set var="delete_confirm_msg">
			<spring:escapeBody javaScriptEscape="true"><spring:message code="entity_delete_confirm" /></spring:escapeBody>
		</c:set>
		<spring:message code="process.instance.delete" htmlEscape="false" var="delete_button" />
		<form:form action="${action_url }" method="DELETE">
			<input type="submit" value="${delete_button }" onclick="return confirm('${delete_confirm_msg}');" alt="${fn:escapeXml(delete_label)}" title="${fn:escapeXml(delete_label)}" />
		</form:form>
	</div>
	<br>

	</div>
	
</body>
</html>